function Pops(contextPath,divContainer){
	if(!divContainer){
		var specialContainerId = "xpopdivcontainer";
		if(typeof this.dataModel==="object"){
			specialContainerId = "xpopdivcontainer1";
		}
		divContainer = window["Comm"].findDivById(specialContainerId);
	}
	View.apply(this,arguments);
	this.popTitle = "";
	this.popButtonNames = "";
	this.popExceptionMessage = "";
	this.beforeRefresh = function(){
		var titleStyleFragment = "";
		if(this.popTitle.indexOf(".")>-1){
			var titleFragment = this.popTitle.split(".");
			titleStyleFragment = titleFragment.pop();
		}
		return '<div class="xpopouter"><div class="xpopouterbottom"><div class="xpopouterleft"><div class="xpopouterright"><div class="xpopoutertop"><span class="xpoptitlespan'+titleStyleFragment+'">'+window["Comm"].getLocalString(this.contextPath,this.popTitle)+'</span><div class="xpopinner" id="xpopinnerdiv"></div><span class="xpopbuttonspan" id="xpopbuttonspan"></span></div></div></div></div></div>';
	};
	
	this.afterRefresh = function(){
		var popInnerDiv = document.getElementById("xpopinnerdiv");
		if(typeof this.dataModel==="object"){
			if(!this.popCard){
				this.popCard = new window["Card"](this.contextPath,popInnerDiv);
			}
			this.popCard.dataModel = this.dataModel;
			this.popCard.refresh();
		}else{
			popInnerDiv.innerHTML = window["Comm"].getLocalString(this.contextPath,this.dataModel);
			popInnerDiv.style.paddingLeft = "2px";
			popInnerDiv.style.paddingTop = "2px";
			popInnerDiv.style.fontWeight = "bold";
		}
		var buttonHtml = "";
		if(!this.popButtonNames||this.popButtonNames.length<1){
			buttonHtml = '&nbsp;&nbsp;&nbsp;&nbsp;<button buttonindex="0">'+window["Comm"].getLocalString(this.contextPath,"common.button.ok")+'</button>';
		}else{
			var buttonNameArray = this.popButtonNames.split(",");
			for(var i=0;i<buttonNameArray.length;i++){
				buttonHtml += '&nbsp;&nbsp;&nbsp;&nbsp;<button buttonindex="'+i+'">'+window["Comm"].getLocalString(this.contextPath,buttonNameArray[i])+'</button>';
			}
		}
		var buttonSpanObject = document.getElementById("xpopbuttonspan");
		buttonSpanObject.innerHTML = buttonHtml;
		var divStyle = this.divContainer.style;
		divStyle.position = "absolute";
		divStyle.display = "";
		divStyle.left = document.body.scrollLeft+(document.body.clientWidth-this.divContainer.offsetWidth)/2;
		divStyle.top = document.body.scrollTop+(document.body.clientHeight-this.divContainer.offsetHeight)/2.5;
		buttonSpanObject.style.width = popInnerDiv.offsetWidth;
	};
}

Pops.prototype = new View();
Pops.prototype.handleClickEvent0 = function(evt){
	var sourceElement = evt.srcElement;
	if(sourceElement.tagName=="BUTTON"){
		var buttonIndex = sourceElement.buttonindex;
		if(buttonIndex==0&&typeof this.dataModel==="object"){
			this.popCard.submitCardValue();
		}else{
			this.divContainer.style.display = "none";
		}
		this.dataModel = null;
	}
};

